var x; var x; var mx2; var my1; function setup(){ createCanvas(400,400); x=200; y=300; mx1=200; } function draw(){ background(0); ellipse(x,y,40,40); y=y+ys; ys=ys+g; if (y+20>400){ ys=-1*ys; } } var x; var y; // x,y is one ellipse var a; var b; // a,b is another var c; function setup(){ createCanvas(600,400); x=100; y=100; a=400; b=120; c=color(0,255,0); } function draw(){ background(c); ellipse(x,y,30,30); ellipse(a,b,40,40); a=a-1; if (dist(x,y,a,b)<35){ } function setup(){ createCanvas(600,400); x=10; } function draw(){ background(0,0,0); ellipse(x,100,20,20); if (keyIsPressed){ if (key=='d'){ x=x+1; } } } var c; function setup(){ createCanvas(600,400); c=color(0,255,0); } function draw(){ background(c); if (keyIsPressed){ if (key=='r'){ c=color(255,0,0); } if (key=='d'){ rect(100,100,40,40); } } } ellipse(mx1,my1,md1, mdi) my1=my1=ms1; if (my1>400); if (mouseIsPressed){ // move bullet to the ship } // draw bullet // move bullet // check for hit against m1 and m2 (and m3) d1 = dist(bx,by,mx1,my1); // repeat for each meteor d2 = ...; if (mouseIsPressed){ // move bullet to ship // set the speed }